package com.mapper.DaoImpl;

import com.Util.MybatisUtil;
import com.entity.Shuihu;
import com.mapper.ShuihuMapper;
import com.qo.QueryObject;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class ShuihuMapperImpl implements ShuihuMapper {
    private SqlSession session = MybatisUtil.getSession();

    @Override
    public void add(Shuihu shuihu) {
        session.insert("com.mapper.ShuihuMapper.add", shuihu);
        session.commit();
    }

    @Override
    public void delById(Long id) {
        session.delete("com.mapper.ShuihuMapper.delById", id);
        session.commit();
    }

    @Override
    public void edit(Shuihu shuihu) {
        session.update("com.mapper.ShuihuMapper.edit", shuihu);
        session.commit();
    }

    @Override
    public Shuihu selOneById(Long id) {
        Shuihu selectOne = session.selectOne("com.mapper.ShuihuMapper.selOneById", id);
        return selectOne;
    }

    @Override
    public List<Shuihu> selAll() {
        return session.selectList("com.mapper.ShuihuMapper.selAll");
    }

    @Override
    public Integer selCount(QueryObject queryObject) {
        return session.selectOne("com.mapper.ShuihuMapper.selCount", queryObject);
    }

    @Override
    public List<Shuihu> selList(QueryObject queryObject) {
        return session.selectList("com.mapper.ShuihuMapper.selList", queryObject);
    }
}
